using UnityEngine;

public class MonoInstance<T> : MonoBehaviour where T : MonoInstance<T>
{
	public static T instance;

	public void Awake()
	{
		if ((Object)instance != (Object)null && instance != this)
		{
			UnityEngine.Debug.LogWarning(instance.name + " instance should be singleton!");
		}
		else
		{
			instance = (T)this;
		}
	}

	public void OnDestroy()
	{
		instance = (T)null;
	}
}
